package com.alex.task.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class AsyncService {
    private int count=0;

    @Async
    public void hello() {
        log.info(Thread.currentThread().getName() + "-> service: 处理数据中...");
        try {
            Thread.sleep(3000);
            count++;
            log.info("service: count -> " + count);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("service: 处理数据完成!");


    }
}
